/**
 * 招聘详情-用于安卓和IOS分享 http://192.168.0.152:8080/lifetime/bluehired/recruitmentlist_detail.html?id=26
 * @author  Jello
 * @create  2018/10/24 20:19
 * @version 1.0
 * @company 广东蓝聘科技网络有限公司
 **/
var spinner = new Spinner(opts);

$(function() {
	//轮播图
	var mySwiper = new Swiper('.swiper-container', {
		initialSlide: 0,
		// 轮播图的方向，也可以是vertical方向
		direction: 'horizontal',
		//播放速度
		loop: true,
		observer: true,
		observeParents: true,
		// 自动播放时间
		autoplay: 4500,
		// 播放的速度
		speed: 300,
		// 如果需要分页器，即下面的小圆点
		pagination: '.swiper-pagination',
		// 这样，即使我们滑动之后， 定时器也不会被清除
		autoplayDisableOnInteraction: false,
		paginationClickable: true,
		pagination: '.swiper-pagination',
		paginationType: 'custom',
		paginationCustomRender: function(swiper, current, total) {
			var html = '';
			for(var i = 1; i <= total; i++) {
				if(current == i) {
					html += '<span class="swiper-pagination-customs swiper-pagination-customs-active"></span>';
				} else {
					html += '<span class="swiper-pagination-customs"></span>';
				}
			}
			return html; //返回所有的页码html
		}
	});

	//截取招聘id
	workId = getParam("id");

	//查询招聘详情
	var param = {};
	param.workId = workId;
	queryWorkDetail(param, function(resultObj) {
		var detailObj = resultObj.data;
		//轮播图
		var swiperList = detailObj.imageList.split(";");
		for(var k = 0; k < swiperList.length; k++) {
			var hot = '<div class="swiper-slide">' +
				'<img src="' + swiperList[k] + '"/></div>';
			$(".swiper-wrapper").append(hot);
			mySwiper.init();
		}
		var status = detailObj.status; //招工状态0正在招工 1已经招满
		var interviewTime = detailObj.interviewTime; //面试时间
		var mechanismId = detailObj.mechanismId; //企业id
		var reMoney = detailObj.reMoney; //返费金额
		var reTime = detailObj.reTime; //返费时间（单位：月）
		var recruitAddress = detailObj.recruitAddress; //面试地址
		var postType = detailObj.postType; //工种0正式1小时
		var mechanismName = detailObj.mechanismName; //公司名称

		if(status == 1) { //招满
			$(".stat_zm").show();
			$(".stat_you").hide();
		}
		if(postType == 1) {
			$("#workMoney").html(detailObj.workMoney + "元/小时"); //工价
		} else if(postType == 0) {
			$("#wageRange").html(detailObj.wageRange + "元/月") //综合工资
		}
		$("#post").html(detailObj.postName); //工种名称
		$("#mechanismName").html(detailObj.mechanismName);
		$("#mechanismScore").html(detailObj.mechanismScore); //企业评分
		$("#maxNumber").html(detailObj.maxNumber); //需求人数
		$("#workTypeName").html(detailObj.workTypeName); //岗位名称
		$("#applyNumber").html(detailObj.applyNumber); //已报名数

		$("#mechanismDetails").html(detailObj.mechanismDetails); //公司简介
		$("#mechanismAddress").html(detailObj.mechanismAddress); //公司地址
		$("#workDemand").html(detailObj.workDemand); //入职要求
		$("#workSalary").html(detailObj.workSalary); //薪资福利
		$("#eatSleep").html(detailObj.eatSleep); //住宿餐饮
		$("#workTime").html(detailObj.workTime); //工作性质
		$("#workKnow").html(detailObj.workKnow); //面试材料
		$("#remarks").html(detailObj.remarks); //其他说明

		var key = detailObj.key.split(","); //关键字
		for(var i = 0; i < key.length; i++) {
			var html_key = '<div class="item_b_box">' + key[i] + '</div>';
			$("#res_key").append(html_key);
		}
	});

});